import defaultSettings from '@/settings'

const { showSettings, fixedHeader, sidebarLogo } = defaultSettings

const state = {
  showSettings: showSettings,
  fixedHeader: fixedHeader,
  sidebarLogo: sidebarLogo,
  pageTitle: '',
  multipleTableData: []
}

const mutations = {
  CHANGE_SETTING: (stateOne, { key, value }) => {
    // eslint-disable-next-line no-prototype-builtins
    if (stateOne.hasOwnProperty(key)) {
      stateOne[key] = value
    }
  },
  setPageTitle: (stateOne, title) => {
    stateOne.pageTitle = title
  },
  setTableCheckData: (stateOne, val) => {
    stateOne.multipleTableData = val
  }
}

const actions = {
  changeSetting({ commit }, data) {
    commit('CHANGE_SETTING', data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

